home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / Text::Soundex.Z / Text::Soundex
Encoding:
Text File  |  1998-10-28  |  4.0 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      TTTTeeeexxxxtttt::::::::SSSSoooouuuunnnnddddeeeexxxx((((3333))))22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222)))) TTTTeeeexxxxtttt::::::::SSSSoooouuuunnnnddddeeeexxxx((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       Text::Soundex    - Implementation of the    Soundex    Algorithm as
  10.       Described by Knuth
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.         use    Text::Soundex;
  14.  
  15.         $code = soundex $string;        # get soundex code for a string
  16.         @codes = soundex @list;        # get list of codes for    list of    strings
  17.  
  18.         # set value    to be returned for strings without soundex code
  19.  
  20.         $soundex_nocode = 'Z000';
  21.  
  22.  
  23.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  24.       This module implements the soundex algorithm as described by
  25.       Donald Knuth in Volume 3 of TTTThhhheeee AAAArrrrtttt ooooffff CCCCoooommmmppppuuuutttteeeerrrr PPPPrrrrooooggggrrrraaaammmmmmmmiiiinnnngggg.
  26.       The algorithm    is intended to hash words (in particular
  27.       surnames) into a small space using a simple model which
  28.       approximates the sound of the    word when spoken by an English
  29.       speaker.  Each word is reduced to a four character string,
  30.       the first character being an upper case letter and the
  31.       remaining three being    digits.
  32.  
  33.       If there is no soundex code representation for a string then
  34.       the value of $soundex_nocode is returned.  This is initially
  35.       set to undef,    but many people    seem to    prefer an _u_n_l_i_k_e_l_y
  36.       value    like Z000 (how unlikely    this is    depends    on the data
  37.       set being dealt with.)  Any value can    be assigned to
  38.       $soundex_nocode.
  39.  
  40.       In scalar context soundex returns the    soundex    code of    its
  41.       first    argument, and in array context a list is returned in
  42.       which    each element is    the soundex code for the corresponding
  43.       argument passed to soundex e.g.
  44.  
  45.         @codes = soundex qw(Mike Stok);
  46.  
  47.       leaves @codes    containing ('M200', 'S320').
  48.  
  49.      EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  50.       Knuth's examples of various names and    the soundex codes they
  51.       map to are listed below:
  52.  
  53.         Euler, Ellery -> E460
  54.         Gauss, Ghosh -> G200
  55.         Hilbert, Heilbronn -> H416
  56.         Knuth, Kant    -> K530
  57.         Lloyd, Ladd    -> L300
  58.         Lukasiewicz, Lissajous -> L222
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      TTTTeeeexxxxtttt::::::::SSSSoooouuuunnnnddddeeeexxxx((((3333))))22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222)))) TTTTeeeexxxxtttt::::::::SSSSoooouuuunnnnddddeeeexxxx((((3333))))
  71.  
  72.  
  73.  
  74.       so:
  75.  
  76.         $code = soundex 'Knuth';          # $code contains 'K530'
  77.         @list = soundex qw(Lloyd Gauss);      # @list contains 'L300', 'G200'
  78.  
  79.  
  80.      LLLLIIIIMMMMIIIITTTTAAAATTTTIIIIOOOONNNNSSSS
  81.       As the soundex algorithm was originally used a lllloooonnnngggg time ago
  82.       in the US it considers only the English alphabet and
  83.       pronunciation.
  84.  
  85.       As it    is mapping a large space (arbitrary length strings)
  86.       onto a small space (single letter plus 3 digits) no
  87.       inference can    be made    about the similarity of    two strings
  88.       which    end up with the    same soundex code.  For    example, both
  89.       Hilbert and Heilbronn    end up with a soundex code of H416.
  90.  
  91.      AAAAUUUUTTTTHHHHOOOORRRR
  92.       This code was    implemented by Mike Stok (stok@cybercom.net)
  93.       from the description given by    Knuth.    Ian Phillips
  94.       (ian@pipex.net) and Rich Pinder (rpinder@hsc.usc.edu)
  95.       supplied ideas and spotted mistakes.
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.